package com.truyen.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.truyen.persistence.dao.TacGiaDao;
import com.truyen.persistence.entity.TacGia;
import com.truyen.service.TacGiaService;
import com.truyen.utils.PagingInfo;


@Service
public class TacGiaServiceImpl implements TacGiaService {
	
	@Autowired
	private TacGiaDao tacGiaDao;

	@Override
	public void save(TacGia entity) {
		tacGiaDao.save(entity);
	}

	@Override
	public TacGia findById(Long id) {
		return tacGiaDao.findById(id);
	}

	@Override
	public List<TacGia> getAll() {
		return tacGiaDao.findAll();
	}

	@Override
	public TacGia findByProperty(String column, Object value) {
		List<TacGia> lst = tacGiaDao.findByProperty(column, value);
		return (lst.size()>0)?lst.get(0):null;
	}

	@Override
	public List<TacGia> getAllLst(String kwSearch, String sort, String sortBy,
			PagingInfo pInfo) {
		return tacGiaDao.getAllLst(kwSearch,sort,sortBy,pInfo);
	}

	@Override
	public List<TacGia> getLstByLoaiTruyen(int loaiTruyen, PagingInfo pInfo) {
		return tacGiaDao.getLstByLoaiTruyen(loaiTruyen,pInfo);
	}

	@Override
	public TacGia findByAliasLoaiTruyen(String alias,
			int loaiTruyen) {
		return tacGiaDao.findByAliasLoaiTruyen(alias,loaiTruyen);
	}


}
